home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
util
/
cdity
/
Yak210src.lha
/
Yak_2.10_Src
/
settings.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-19
|
27KB
|
924 lines
#define __USE_SYSBASE
#include <exec/types.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <libraries/iffparse.h>
#include <prefs/prefhdr.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/iffparse.h>
#include <string.h>
#include "code.h"
#include "yak.h"
#include "Requesters.h"
#include "handlers.h"
#include "hotkey_types.h"
#include "Settings.h"
#define CATCOMP_NUMBERS
#include "yak_locale_strings.h"
extern struct Library *IFFParseBase;
#if defined (PREFS) || defined (CONV)
# ifdef _DCC
# include <lists.h>
# else
# include "sas_lists.h"
# endif
# include "gui.h"
# include "Root_window.h"
# include "MouseCycling_window.h"
# include "Options_window.h"
# include "KeyDef_window.h"
# include "Blank_window.h"
# include "Misc_window.h"
# include "Hotkey_window.h"
static APTR WriteConfig(struct IFFHandle *iff, UBYTE *chunkbuf);
static APTR WriteHandlers(struct IFFHandle *iff, UBYTE *chunkbuf);
static APTR WriteHotkey(struct IFFHandle *iff, UBYTE *chunkbuf, YakHotKey *yhk);
#else
# include "ClickDrive.h"
# include "BlackBorder.h"
# include "MMB_Shift.h"
# include "UnixDirs.h"
# include "FullWorkbench.h"
#endif
#ifndef CONV
static APTR ReadConfig(UBYTE *chunkbuf, ULONG size);
static APTR ReadHandlers(UBYTE *chunkbuf, ULONG size);
static APTR ReadHotkey(UBYTE *chunkbuf, ULONG size);
#endif
#define ID_YKCF MAKE_ID('Y','K','C','F')
#define ID_YKHD MAKE_ID('Y','K','H','D')
#define ID_YKHK MAKE_ID('Y','K','H','K')
static UWORD PrefsVersionRead;
/*
* Used for compatibility
*
* +----------------+-------------+
* |YAKPREFSVERSION | Yak version |
* +----------------+-------------+
* | 0 | Yak 2.00 |
* | 1 | Yak 2.04 |
* +----------------+-------------+
*/
#define YAKPREFSVERSION 1
#define MAXBUFSIZE 1024
#define DEF_AUTOPOINT_DELAY 2
ULONG autopoint_delay; /* used for autopoint */
#define DEF_VOLUME 48
ULONG click_volume; /* used for keyclick */
#define DEF_SCREENBLANKSECS 300
ULONG blanksecs;
ULONG blanktimeout;
ULONG blankcount; /* countdown to blank-time */
ULONG screenblank; /* method used to blank screen */
#define DEF_MOUSEBLANKSECS 5
ULONG mouseblank; /* method used to blank mouse */
ULONG mblanksecs;
ULONG mblanktimeout;
ULONG mblankcount; /* countdown to mouse-blank-time */
static const BOOL DEF_TOGGLE[NUM_TOGGLES] = {
TRUE, /* autopoint */
FALSE, /* keyactivate */
FALSE, /* autopop */
FALSE, /* rmbactivate */
FALSE, /* wildstar */
TRUE, /* scractivate */
FALSE, /* noclick */
FALSE, /* mmbactivate */
FALSE, /* blackborder */
TRUE, /* blankmouseonkey */
FALSE, /* mmbshift */
FALSE, /* UnixDirs */
FALSE, /* SlashDir */
FALSE /* fullworkbench */
};
#ifdef PREFS
# define TOGGLE_DESCRIPTION(DefState, Gadget, WindowID) {(BOOL)DefState, (UWORD)Gadget, (UBYTE)WindowID}
#else /* Yak commodity only */
# define TOGGLE_DESCRIPTION(DefState, Gadget, WindowID) {(BOOL)DefState}
#endif
ToggleData toggles[] = {
TOGGLE_DESCRIPTION( TRUE, GDX_AutoCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_KeyActCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_AutoPopCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_RMBActCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_WildStarCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION( TRUE, GDX_ScrActCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_NoClickCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_MMBActCheck, ROOT_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_BlackBorderCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION( TRUE, GDX_BlankMouseOnKey, BLANK_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_MMBShiftCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_UnixDirsCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_SlashDirCheck, MISC_WINDOW),
TOGGLE_DESCRIPTION(FALSE, GDX_FullWorkbenchCheck, MISC_WINDOW)
};
static const char *DEF_PATTERN[NUM_PATTERNS] = {
"#?", /* autoactivation screens */
"~(Workbench)" /* autopop windows */
};
PatternData patterns[NUM_PATTERNS] = {
{ "#?", NULL }, /* autoactivation screens */
{ "~(Workbench)", NULL } /* autopop windows */
};
/* Chunks to stop on */
#define NUMSTOPS 3
LONG stopchunks[] = {
ID_PREF, ID_YKCF,
ID_PREF, ID_YKHD,
ID_PREF, ID_YKHK
};
struct PrefHeader PrefHdrChunk = {
YAKPREFSVERSION, 0, 0
};
/* parse pattern, report errors */
__regargs BOOL
InitPattern(char *newpatstr, PatternData *pdata)
{
char *patstr = newpatstr ? newpatstr : pdata->patstr;
char *pat;
LONG len;
if (pat = AllocVec(len = strlen(patstr)*3+10, MEMF_CLEAR))
{
if (ParsePattern(patstr, pat, len) != -1)
{
if (newpatstr) strncpy(pdata->patstr, newpatstr, PATLEN);
if (pdata->pat) FreeVec(pdata->pat);
pdata->pat = pat;
return TRUE;
}
PostError("%s:\n\"%s\"", getString(Parsing_Pattern_ERR), patstr);
FreeVec(pat);
}
else PostError(getString(Allocation_ERR));
return FALSE;
}
/* Set default settings */
void
SetDefaultSettings(void)
{
register UWORD i;
/* Config */
for (i=0; i < NUM_TOGGLES; i++)
toggles[i].pos = DEF_TOGGLE[i];
for (i=0; i< NUM_PATTERNS; i++)
strcpy(patterns[i].patstr, DEF_PATTERN[i]);
autopoint_delay = DEF_AUTOPOINT_DELAY;
click_volume = DEF_VOLUME;
blanksecs = DEF_SCREENBLANKSECS;
mblanksecs = DEF_MOUSEBLANKSECS;
mouseblank = MB_SPRITES;
screenblank = SB_BLACKSCREEN;
/* Hotkeys */
DeleteYakHotKeyList();
/* Mouse Cycling */
CleanMouseCycling();
for (i=0; i<NUM_HANDLERS; i++)
{
CopyMem((char *)&DEF_MOUSECYCLING[i], (char *)&MouseCyclingHandlers[i], (long)sizeof(YakHandler));
MouseCyclingHandlers[i].KeyDef = DupStr(MouseCyclingHandlers[i].KeyDef);
}
}
#define WORD_ALIGN(ptr) ((ULONG)(ptr + 1) & ~1)
#ifndef CONV
/* Read Preferences */
void
LoadSettings(char *filename)
{
struct IFFHandle *iff;
APTR error = Opening_prefs_file_ERR; /* Temporarily */
BOOL cont = TRUE;
/* First: set default values */
SetDefaultSettings();
/* Allocate IFF handle */
if (iff=AllocIFF())
{
/* Open IFF File */
if (iff->iff_Stream=Open(filename, MODE_OLDFILE))
{
/* Init IFF handle */
InitIFFasDOS(iff);
/* Open IFF handle */
if (!OpenIFF(iff, IFFF_READ))
{
/* Set IFF chunk types */
if (!PropChunk(iff, ID_PREF, ID_PRHD) &&
!StopChunks(iff, stopchunks, NUMSTOPS) &&
!StopOnExit(iff, ID_PREF, ID_FORM) )
{
error = Invalid_prefs_file_ERR; /* Temporarily */
/* Start IFF parsing */
if (!ParseIFF(iff, IFFPARSE_STEP))
{
struct ContextNode *cn;
/* Check IFF type */
if ( (cn=CurrentChunk(iff)) &&
(cn->cn_ID == ID_FORM) &&
(cn->cn_Type == ID_PREF) )
{
if (!ParseIFF(iff, IFFPARSE_SCAN))
{
struct StoredProperty *sp;
/* Get pointer to PRHD chunk */
if (sp=FindProp(iff, ID_PREF, ID_PRHD))
{
struct PrefHeader *ph=(struct PrefHeader *) sp->sp_Data;
PrefsVersionRead = ph->ph_Version;
error = NULL; /* No error: temporarily */
/* Parse IFF chunks */
do
{
APTR localerr;
char localstr[5];
/* Get current chunk */
if (cn=CurrentChunk(iff))
{
UBYTE *chunkbuf;
ULONG size=cn->cn_Size;
/* Allocate memory for config buffer */
if (chunkbuf=AllocVec(size, 0L))
{
/* Read chunk */
if (ReadChunkBytes(iff, chunkbuf, size) == size)
{
switch(cn->cn_ID)
{
case ID_YKCF:
localerr = ReadConfig(chunkbuf, size);
break;
case ID_YKHK:
localerr = ReadHotkey(chunkbuf, size);
break;
case ID_YKHD:
localerr = ReadHandlers(chunkbuf, size);
break;
}
if (localerr)
{
cont = (BOOL)GetOrders(getString(Continue_Abort_ORDERS),
getString(localerr),
IDtoStr(cn->cn_ID, localstr));
}
}
else
{
PostError(getString(Reading_prefs_file_ERR));
cont = FALSE;
}
FreeVec(chunkbuf);
}
else
{
PostError(getString(Allocation_ERR));
cont = FALSE;
}
}
/* Next parse step */
} while ((!ParseIFF(iff, IFFPARSE_SCAN)) && cont);
}
}
}
}
}
CloseIFF(iff);
}
Close(iff->iff_Stream);
}
FreeIFF(iff);
}
else
PostError(getString(Allocation_ERR));
if (error)
PostError("%s\n\"%s\"", getString(error), filename);
}
/* YKCF chunk format
*
* UWORD NUM_TOGGLES
* BOOL toggles[]
* UWORD click_volume
* UWORD autopoint_delay
* UWORD blanksecs
* UWORD mblanksecs
* UWORD mouseblank
* UWORD screenblank
* UWORD NUM_PATTERNS
* STRING patterns[]
*/
static APTR
ReadConfig(UBYTE *chunkbuf, ULONG size)
{
UWORD *puword=(UWORD *)chunkbuf;
BOOL *pbool;
UBYTE *pstr;
UWORD i, n;
if ((n=*puword) > (UWORD)NUM_TOGGLES)
{
n = (UWORD) NUM_TOGGLES;
}
pbool = puword+1;
for (i = 0; i < n; i++)
toggles[i].pos = *pbool++;
puword = pbool;
/* Miscellaneous */
click_volume = *puword++;
autopoint_delay = *puword++;
blanksecs = *puword++;
mblanksecs = *puword++;
mouseblank = *puword++;
if (mblanksecs == 0)
{
mouseblank = MB_NONE;
}
if (PrefsVersionRead > 0)
{
screenblank = *puword++;
if (blanksecs == 0)
{
screenblank = SB_NONE;
}
}
if ((n=*puword++) <= NUM_PATTERNS)
{
pstr = (UBYTE *)puword;
for (i = 0; i < n; i++)
{
strncpy(patterns[i].patstr, pstr, PATLEN);
patterns[i].patstr[PATLEN] = '\0';
pstr += strlen(pstr)+1;
}
#ifndef PREFS /* Yak */
/* set-up patterns */
for (i = 0; i < NUM_PATTERNS; i++)
InitPattern(NULL, &patterns[i]);
if (wildstar)
WILDSTARON;
else
WILDSTAROFF;
SetClickDrive(noclick);
ToggleBlackBorder(blackborder);
ToggleFullWorkbench(fullworkbench);
ToggleUnixDirs(unixdirs);
ToggleMMBShift(mmbshift);
blankcount = blanktimeout = 10*blanksecs;
mblankcount = mblanktimeout = 10*mblanksecs;
#endif
if ((pstr-chunkbuf) == size)
{
/* Reading Ok */
return 0L;
}
}
return Reading_chunk_ERR;
}
/* YKHK chunk format
*
* UWORD type
* UWORD state
* STRING name
* STRING keydef
* UWORD optsnum
* UWORD flags
* [ STRING argstr[] ]
* [ LONG argnum[] ]
* .
* .
* .
*
*/
static APTR
ReadHotkey(UBYTE *chunkbuf, ULONG size)
{
register UWORD *puword=(UWORD *)chunkbuf;
register UBYTE *pstr;
void *pvoid;
LONG *plong;
YakHotKey *yhk;
UWORD type;
UWORD ol, optsnum;
OptDescription *curdesc;
if ((type=*puword++) < NUM_HOTKEY_TYPES)
{
if (yhk = NewYakHotKey(type))
{
yhk->yhk_State = *puword++; /* State */
pstr = (UBYTE *)puword;
if (ModifyYHKName(yhk, pstr)) /* Name */
{
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
if (ModifyYHKKeyDef(yhk, pstr)) /* KeyDef */
{
pstr += strlen(pstr)+1;
/* Options */
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
optsnum = *puword++;
pvoid = (void *)puword;
for (ol=0; ol<optsnum; ol++)
{
UWORD as=0; /* ArgStr number */
UWORD an=0; /* ArgNum number */
curdesc = yhktypes[yhk->yhk_Type].yhkt_OptsList[ol].Desc;
puword = (UWORD *)pvoid;
yhk->yhk_Option[ol].Flags = *puword++;
pvoid = (void *)puword;
while (curdesc->Type != NO_OPT)
{
switch(curdesc->Type)
{
case STRING_OPT:
if (yhk->yhk_Option[ol].Flags & curdesc->LocalID)
{
pstr = (UBYTE *)pvoid;
yhk->yhk_Option[ol].ArgStr[as] = DupStr(pstr);
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
pvoid = (void *)WORD_ALIGN(pstr);
}
as++;
break;
case INTEGER_OPT:
if (yhk->yhk_Option[ol].Flags & curdesc->LocalID)
{
plong = (LONG *)pvoid;
yhk->yhk_Option[ol].ArgNum[an] = *plong++;
pvoid = (void *)plong;
}
an++;
break;
}
curdesc++;
}
}
if (((UBYTE *)pvoid-chunkbuf) == size)
return 0L; /* Reading Ok */
}
}
DeleteYakHotKey(yhk);
}
}
return Reading_chunk_ERR;
}
/* YKHD chunk format
*
* UWORD NUM_HANDLERS
* UWORD handler[0].State
* UWORD handler[0].RequiredClicks
* STRING handler[0].KeyDef
* STRING handler[0].ScreenPatternStr
* .
* .
* .
*/
static APTR
ReadHandlers(UBYTE *chunkbuf, ULONG size)
{
register UWORD *puword=(UWORD *)chunkbuf;
register UBYTE *pstr;
register UWORD i,n;
if ((n=*puword++) <= NUM_HANDLERS)
{
for (i = 0; i < n; i++)
{
char *keydef;
MouseCyclingHandlers[i].State = *puword++;
MouseCyclingHandlers[i].RequiredClicks = *puword++;
MouseCyclingHandlers[i].Options = *puword++;
pstr = (UBYTE *)puword;
keydef = DupStr(pstr);
if (MouseCyclingHandlers[i].KeyDef)
FreeVec(MouseCyclingHandlers[i].KeyDef);
MouseCyclingHandlers[i].KeyDef = keydef;
pstr += strlen(pstr)+1;
strncpy(MouseCyclingHandlers[i].ScreenPatternData.patstr, pstr, PATLEN);
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
}
ToggleMouseCycling();
if (((UBYTE *)puword-chunkbuf) == size)
return 0L; /* Reading Ok */
}
return Reading_chunk_ERR;
}
#endif
#if defined(PREFS) || defined(CONV)
/* Copy a file */
#define COPYBUFSIZE 2048
BOOL
CopyFile(char *source, char *dest)
{
BOOL ret=FALSE;
char *copybuf;
/* Allocate copy buffer */
if (copybuf= AllocMem(COPYBUFSIZE, 0))
{
BPTR infh;
/* Open source file */
if (infh=Open(source, MODE_OLDFILE))
{
BPTR outfh;
/* Open destination file */
if (outfh=Open(dest, MODE_NEWFILE))
{
LONG n;
/* Copy file */
while ((n=Read(infh, copybuf, COPYBUFSIZE)) > 0)
if (Write(outfh, copybuf, n) != n) break;
/* No error? */
if (!n) ret=TRUE;
Close(outfh);
}
Close(infh);
}
FreeMem(copybuf, COPYBUFSIZE);
}
else
PostError(getString(Allocation_ERR));
return ret;
}
/* Write Preferences */
void
SaveSettings(char *filename)
{
UBYTE *chunkbuf;
APTR error = Opening_prefs_file_ERR; /* Temporarily */
/* Allocate memory for config buffer */
if (chunkbuf=AllocVec(MAXBUFSIZE, 0L))
{
struct IFFHandle *iff;
/* Allocate IFF handle */
if (iff=AllocIFF())
{
/* Open IFF File */
if (iff->iff_Stream=Open(filename, MODE_NEWFILE))
{
/* Init IFF handle */
InitIFFasDOS(iff);
/* Open IFF handle */
if (!OpenIFF(iff, IFFF_WRITE))
{
error = Writing_prefs_file_ERR; /* Temporarily */
/* Push FORM IFF chunk */
if (!PushChunk(iff, ID_PREF, ID_FORM, IFFSIZE_UNKNOWN))
{
/* Write PRHD IFF chunk */
if (!PushChunk(iff, 0, ID_PRHD, sizeof(struct PrefHeader)) &&
(WriteChunkBytes(iff,
(UBYTE *) &PrefHdrChunk,
sizeof(struct PrefHeader)) == sizeof(struct PrefHeader)) &&
!PopChunk(iff))
{
YakHotKey *yhk;
register UWORD type;
error = WriteConfig(iff, chunkbuf);
if (!error) error = WriteHandlers(iff, chunkbuf);
for (type = 0; type < NUM_HOTKEY_TYPES && !error; type++)
for (yhk = (YakHotKey *)GetHead(keylist(type));
yhk && !error;
yhk = (YakHotKey *)GetSucc(yhk))
{
error = WriteHotkey(iff, chunkbuf, yhk);
}
}
if (PopChunk(iff)) /* close out the FORM */
error = Writing_prefs_file_ERR;
}
CloseIFF(iff);
}
Close(iff->iff_Stream);
}
FreeIFF(iff);
}
FreeVec(chunkbuf);
}
else
PostError(getString(Allocation_ERR));
if (error)
PostError("%s\n\"%s\"", getString(error), filename);
}
static APTR
WriteConfig(struct IFFHandle *iff, UBYTE *chunkbuf)
{
register UWORD *puword=(UWORD *)chunkbuf;
register BOOL *pbool;
register UBYTE *pstr;
register UWORD i;
ULONG size=0;
/* toggles */
*puword++ = (UWORD) NUM_TOGGLES;
pbool = puword;
for (i = 0; i < NUM_TOGGLES; i++)
*pbool++ = toggles[i].pos;
puword = pbool;
/* miscellaneous */
*puword++ = click_volume;
*puword++ = autopoint_delay;
*puword++ = blanksecs;
*puword++ = mblanksecs;
*puword++ = mouseblank;
*puword++ = screenblank;
/* patterns */
*puword++ = NUM_PATTERNS;
pstr = (UBYTE *)puword;
for (i = 0; i < NUM_PATTERNS; i++)
{
strcpy(pstr, patterns[i].patstr);
pstr += strlen(pstr)+1;
}
/* Write Chunk */
size = pstr - chunkbuf;
if ((PushChunk(iff, 0, ID_YKCF, size)) ||
(WriteChunkBytes(iff, chunkbuf, size) != size) ||
(PopChunk(iff)))
return Writing_prefs_file_ERR;
/* All OK. */
return NULL;
}
static APTR
WriteHotkey(struct IFFHandle *iff, UBYTE *chunkbuf, YakHotKey *yhk)
{
UWORD *puword=(UWORD *)chunkbuf;
UBYTE *pstr;
void *pvoid;
LONG *plong;
UWORD ol, optsnum;
OptDescription *curdesc;
ULONG size;
*puword++ = yhk->yhk_Type; /* Type */
*puword++ = yhk->yhk_State; /* State */
pstr = (UBYTE *)puword;
strcpy(pstr, yhk->yhk_Name); /* Name */
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
strcpy(pstr, yhk->yhk_KeyDef); /* KeyDef */
pstr += strlen(pstr)+1;
/* Options */
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
*puword++ = optsnum = YHK_Takes_Opt(yhk);
pvoid = (void *)puword;
for (ol=0; ol<optsnum; ol++)
{
UWORD as=0; /* ArgStr number */
UWORD an=0; /* ArgNum number */
curdesc = yhktypes[yhk->yhk_Type].yhkt_OptsList[ol].Desc;
puword = (UWORD *)pvoid;
*puword++ = yhk->yhk_Option[ol].Flags;
pvoid = (void *)puword;
while (curdesc->Type != NO_OPT)
{
switch(curdesc->Type)
{
case STRING_OPT:
if (yhk->yhk_Option[ol].Flags & curdesc->LocalID)
{
pstr = (UBYTE *)pvoid;
strcpy(pstr, yhk->yhk_Option[ol].ArgStr[as]);
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
pvoid = (void *)WORD_ALIGN(pstr);
}
as++;
break;
case INTEGER_OPT:
if (yhk->yhk_Option[ol].Flags & curdesc->LocalID)
{
plong = (LONG *)pvoid;
*plong++ =yhk->yhk_Option[ol].ArgNum[an];
pvoid = (void *)plong;
}
an++;
break;
}
curdesc++;
}
}
/* Write Chunk */
size = (UBYTE *)pvoid - chunkbuf;
if ((PushChunk(iff, 0, ID_YKHK, size)) ||
(WriteChunkBytes(iff, chunkbuf, size) != size) ||
(PopChunk(iff)))
return Writing_prefs_file_ERR;
/* All OK. */
return 0L;
}
static APTR
WriteHandlers(struct IFFHandle *iff, UBYTE *chunkbuf)
{
UWORD *puword=(UWORD *)chunkbuf;
UBYTE *pstr;
register UWORD i;
ULONG size;
*puword++ = NUM_HANDLERS;
for (i=0; i< NUM_HANDLERS; i++)
{
*puword++ = MouseCyclingHandlers[i].State;
*puword++ = MouseCyclingHandlers[i].RequiredClicks;
*puword++ = MouseCyclingHandlers[i].Options;
pstr = (UBYTE *)puword;
strcpy(pstr, MouseCyclingHandlers[i].KeyDef);
pstr += strlen(pstr)+1;
strcpy(pstr, MouseCyclingHandlers[i].ScreenPatternData.patstr);
pstr += strlen(pstr)+1;
/* Take care of non word aligned addresses for 68000 */
puword = (UWORD *)WORD_ALIGN(pstr);
}
/* Write Chunk */
size = (UBYTE *)puword - chunkbuf;
if ((PushChunk(iff, 0, ID_YKHD, size)) ||
(WriteChunkBytes(iff, chunkbuf, size) != size) ||
(PopChunk(iff)))
return Writing_prefs_file_ERR;
/* All OK. */
return NULL;
}
#endif